/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.gis.eemc.web;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import net.gis.eemc.dao.FacultyDAO;
import net.gis.eemc.dao.FacultyDAOImpl;
import net.gis.eemc.domain.Faculty;

/**
 *
 * @author Sergey
 */
@ManagedBean(name = "facultyBean")
@RequestScoped
public class AddFacultyBean {

    String title = null;
    String shortName = null;
    private FacultyDAO facDAO = null;

    /** Creates a new instance of AddFacultyBean */
    public AddFacultyBean() {
        facDAO = new FacultyDAOImpl();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public void Save() {
        if (title != null && shortName != null) {
            facDAO.addFaculty(new Faculty(title, shortName));
        }
    }
}
